<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of uniqueColors</title>
  <meta name="keywords" content="uniqueColors">
  <meta name="description" content="Generate m*n visually distinct RGB colors suitable for display.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html matlab -->
<h1>uniqueColors
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Generate m*n visually distinct RGB colors suitable for display.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function clrs = uniqueColors( m, n, show, offset ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Generate m*n visually distinct RGB colors suitable for display.

 Useful when more than the 6 standard 'rgbcym' colors are needed for
 display. Generate m*n colors by sampling at constant intervals in HSV in
 the H and S channels (while keeping V fixed at 1). In addition, for every
 other level of saturation the H values are offset by half an interval to
 further distinguish each color. Inspired by a blog entry by Bart Mossey
 http://fob.po8.org/node/398, HOWTO: Picking &quot;random colors&quot;.

 USAGE
  clrs = uniqueColors( m, n, [show], [offset] )

 INPUTS
  m      - number of saturation levels
  n      - number of distinct hues to use
  show   - optional display of colors
  offset - [1] offset every other row of colors

 OUTPUTS
  clrs   - [m*n x 3] array of rgb colors

 EXAMPLE - standard 6 fully saturated colors
  clrs = uniqueColors(1,6,1);

 EXAMPLE - 24 colors used to plot some points
  clrs = uniqueColors(4,6,1);
  figure(2); clf; hold on; n=size(clrs,1);
  for i=1:n, plot(mod(i-1,6),i,'.','color',clrs(i,:)); end

 See also hsv2rgb, colormap, hsv, jet

 Piotr's Computer Vision Matlab Toolbox      Version 2.51
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]</pre></div>





<!-- Start of Google Analytics Code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4884268-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<!-- end of Google Analytics Code -->

<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>
